﻿using Microsoft.Win32;
using System.Windows.Controls;

namespace Smokey.Client.Screens.Applications {
    internal partial class ViewApplication : UserControl {
        public ViewApplication() {
            InitializeComponent();
        }

        public ViewApplicationViewModel ViewModel {
            get {
                return (ViewApplicationViewModel)this.DataContext;
            }
        }

        private void SaveButton_Click(object sender, System.Windows.RoutedEventArgs e) {
            ViewModel.UpdateChanges();
        }

        private void BrowseButton_Click(object sender, System.Windows.RoutedEventArgs e) {
            var fileDialog = new OpenFileDialog();
            fileDialog.DefaultExt = ".exe";
            fileDialog.Filter = "Executable Files (*.exe)|*.exe";
            fileDialog.ShowDialog();
            ViewModel.Application.Location = fileDialog.FileName;
        }
    }
}
